"use client"
import type { Metadata } from "next";
import React, { useState } from 'react';

import {
  MenuFoldOutlined,
  MenuUnfoldOutlined,
  UploadOutlined,
  UserOutlined,
  VideoCameraOutlined,
} from '@ant-design/icons';
import { Button, Layout, Menu, theme } from 'antd';
import { usePathname,useRouter } from "next/navigation";
// import { AntdRegistry } from '@ant-design/nextjs-registry';

const { Header, Sider, Content } = Layout;
// export const metadata: Metadata = {
//   title: "My App",
//   description: "Generated by Next.js",
// };

export default function RootLayout({
  children,
}: Readonly<{
  children: React.ReactNode;
}>) {
  const pathname=usePathname()
  const router=useRouter()
  const [collapsed, setCollapsed] = useState(false);
  const {
    token: { colorBgContainer, borderRadiusLG },
  } = theme.useToken();
  return (
    <html>
      <body>
        
    <Layout style={{height:'100vh'}}>
      <Sider trigger={null} collapsible collapsed={collapsed} style={{background:"white"}}>
        <div className="demo-logo-vertical" />
      <h3>订单管理</h3>
        <Menu
          theme="light"
          mode="inline"
          defaultSelectedKeys={[pathname]}
          defaultOpenKeys={['/zwy/page',pathname]}
          onSelect={(obj)=>{
            router.push(obj.key)
          }}
          items={[
            {
              key: '/zwy/aaa',
              label: '订单列表',
            },
            {
              key: '/zwy/bbb',
              label: '我的订单',
            },
            {
              key: '/zwy/ccc',
              label: '下属订单',
            },
            {
              key: '/zwy/ddd',
             
              label: '我协作的',
            },
            {
              key: '/zwy/eee',
              label: '下属协作',
            },
            {
              key: '/zwy/fff',
              label: '添加订单',
            }
          
          ]}
        />
      </Sider>
      <Layout>
        <Header style={{ padding: 0, background: colorBgContainer }}>
          <Button
            type="text"
            icon={collapsed ? <MenuUnfoldOutlined /> : <MenuFoldOutlined />}
            onClick={() => setCollapsed(!collapsed)}
            style={{
              fontSize: '16px',
              width: 64,
              height: 64,
            }}
          />
        </Header>
        <Content
          style={{
            margin: '24px 16px',
            padding: 24,
            minHeight: 280,
            background: colorBgContainer,
            borderRadius: borderRadiusLG,
          }}
        >
          {children}
        </Content>
      </Layout>
    </Layout>
      </body>
    </html>
  );
}
